package cn.pfz.advice;


import org.apache.shiro.authz.AuthorizationException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

//监听捕获异常
@ControllerAdvice
public class MyConntrollerAdvice {

    @ExceptionHandler(AuthorizationException.class)
    public void UnknownAccountException(AuthorizationException e, HttpServletResponse response) throws IOException {
        response.sendRedirect("http://localhost:8080/erro/nopermission");
    }
}
